<?php

namespace app\controller;

use app\BaseController;
use think\Request;
use app\service\SnService;
use Exception;

class Sn extends BaseController
{    
    protected $middleware = [
        \app\middleware\LoginCheck::class
    ];
    protected $request;
    protected $snService;
    public function __construct(Request $request,SnService $snService)
    {       
        $this->request = $request;
        $this->snService = $snService;
    }    

    public function get()
    {       
        try {   
            $params = $this->request->param();         
            $data = $this->snService->get($params['type']);
        } catch (Exception $e) {
            return $this->error($e->getMessage());
        }

        return $this->success($data);
    }   
}
